<style scoped></style>

<template>
    <i-switch size="large" v-model="switchVal">
        <span slot="open">启用</span>
        <span slot="close">停用</span>
    </i-switch>
</template>

<script>
    export default{
        props: {
            vStatus: false
        },
        watch: {
            switchVal (newVal, oldVal) {
                this.$Modal.confirm({
                    content: '确定修改吗！',
                    onOk: () => {
                        this.$emit('input', newVal);
                    },
                    onCancel: () => {
                        this.switchVal = oldVal;
                    }
                });
            }
        },
        data () {
            return {
                switchVal: this.vStatus
            };
        }
    };
</script>